[pull] main from MetaMask:main#402
Merged
Merged
Conversation
## **Description** Fix default blockexplorer for linea and mainnet. Also fixes showing the block explorer url for all our popular networks. ## **Changelog** CHANGELOG entry: Add default blockexplorer for linea and mainnet. ## **Related issues** Fixes: #15118 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Adds a fallback to resolve block explorer URLs from PopularList or BlockExplorerUrl when network configurations lack them, and updates NetworkSettings initialization and tests accordingly. > > - **Network Settings (UI/logic)**: > - Add `getDefaultBlockExplorerUrl(chainId, networkType)` using `PopularList` (by `chainId`) with fallback to `BlockExplorerUrl` (by network type/clientId). > - Use fallback when `networkConfiguration.blockExplorerUrls` is missing or empty and when selecting built-in networks via `networkTypeOrRpcUrl` or RPCs via `networkClientId`. > - Initialize `blockExplorerUrl` and `blockExplorerUrls` with fallback; keep existing behavior when config provides values. > - **Tests**: > - Add test asserting fallback when `blockExplorerUrls` is empty. > - Update/expand initialization and validation tests to cover new fallback and related flows. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9364b61. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This bumps Snaps packages to the latest version. Notable changes include: - Fetching registry without caching - Add `DateTimePicker` component - Increase default ping timeout to prevent stability problems on low-end systems - Use `crypto.subtle.digest` for faster SHA-256 hashing when verifying the Snaps registry To support the `crypto.subtle.digest` change, this PR adds `react-native-quick-crypto` as a shim for the digest function, which has full parity. Additionally this PR adds usage of `hmacSha512` from `native-utils` to usages of key-tree. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: Improve Snaps registry verification speed. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Upgrades Snaps packages and RN datetime picker, introduces SnapUIDateTimePicker with renderer/field support and tests, adds crypto.subtle digest shim and hmacSha512 usage, and adjusts execution service/controller logic and E2E tests. > > - **UI/Renderer**: > - **New `SnapUIDateTimePicker`**: Component, styles, renderer mapping (`components/index.ts`, `components/date-time-picker.ts`), Field support (`field.ts`), and snapshots/tests. > - Add `testID` to container `ScrollView` and update snapshots. > - Tweak `SnapInterfaceContext` event payload to omit undefined fields. > - **Snaps Engine/Controllers**: > - Use `hmacSha512` from `@metamask/native-utils` in keyring, snap controller, and permissions. > - Remove explicit `pingTimeout` from execution service init and update tests. > - **Platform/Crypto**: > - Shim `crypto.subtle.digest` via `react-native-quick-crypto` in `shim.js`. > - **E2E/Tests**: > - Update Test Snaps URL to `3.1.0`; add E2E flows for date/time pickers; adjust disabled-state assertions. > - **Dependencies**: > - Bump `@MetaMask/snaps-*` and `@metamask/snaps-sdk` packages; upgrade `@react-native-community/datetimepicker` to `8.5.1` (Podfile.lock + yarn.lock). > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 37178ea. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Guillaume Roux <guillaumeroux123@gmail.com>
…23860) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> This PR aims to prevent send asset page to not filter assets when user picks nonEVM and then goes back to asset page. (or vice versa) Asset page now only filter if there is predefined network is marked. This issue introduced in 7.61 hence we don't need any changelog if we decide to CP. ## **Changelog** <!-- If this PR is not End-User-Facing and should not show up in the CHANGELOG, you can choose to either: 1. Write `CHANGELOG entry: null` 2. Label with `no-changelog` If this PR is End-User-Facing, please write a short User-Facing description in the past tense like: `CHANGELOG entry: Added a new tab for users to see their NFTs` `CHANGELOG entry: Fixed a bug that was causing some NFTs to flicker` (This helps the Release Engineer do their job more quickly and accurately) --> CHANGELOG entry: ## **Related issues** Fixes: #23859 ## **Manual testing steps** ```gherkin Feature: my feature name Scenario: user [verb for user action] Given [describe expected initial app state] When user [verb for user action] Then [describe expected outcome] ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** https://github.com/user-attachments/assets/b40544af-3f63-45ed-b192-c8421d4f6b28 ### **After** https://github.com/user-attachments/assets/dcf9b56a-f970-4722-81ca-de2dd2957dec ## **Pre-merge author checklist** - [X] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [X] I've completed the PR template to the best of my ability - [X] I’ve included tests if applicable - [X] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [X] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > useSendTokens now filters tokens only when a predefined chain type is set via new isPredefined* flags from useSendType; tests updated accordingly. > > - **Hooks**: > - **useSendType**: Exposes new booleans `isPredefinedEvm`, `isPredefinedSolana`, `isPredefinedBitcoin`, `isPredefinedTron` derived from `predefinedRecipient.chainType`; returns them alongside existing send-type flags. > - **useSendTokens**: Uses `isPredefined*` flags to determine filtering (`eip155`, `solana`, `tron`, `bip122`); defaults to returning all tokens when no predefined type is set; memo deps updated. > - **Tests**: > - Updated `useSendTokens.test`, `useSendType.test`, `useAccounts.test`, `useContacts.test`, and `recipient.test` to reflect `isPredefined*` behavior and expectations. > - Added `createMockUseSendType` helpers in tests to simplify mocking return values. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 9127b8d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
…ent (#23246) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** This PR implements analytics tracking for RPC endpoint management by renaming the `NETWORK_ADDED` event to `RPC_ADDED` and adding a new `RPC_DELETED` event, both with the `rpc_url_index` property to track which RPC endpoint index is being added or removed. **Reason for change:** Users can now add multiple RPC endpoints to a single network. We need to track which RPC endpoint index is being added or deleted to better understand user behavior and network configuration patterns. **Improvement/Solution:** - Renamed `NETWORK_ADDED` event to `RPC_ADDED` to better reflect that we're tracking RPC endpoint additions, not just network additions - Added new `RPC_DELETED` event to track when RPC endpoints are removed - Added `rpc_url_index` property to both events: - `0` indicates there is only 1 RPC URL for the network (first/only endpoint) - Higher values indicate additional RPC endpoints - Standardized all `chain_id` values to use `toHex()` format for consistency across all RPC tracking events - Updated tracking in: - `NetworkModal` - when networks are added via UI - `wallet_addEthereumChain` - when RPC endpoints are added via RPC method - `NetworkSettings` - when RPC endpoints are added/removed in network settings ## **Changelog** CHANGELOG entry: null ## **Related issues** Fixes: https://consensyssoftware.atlassian.net/browse/TMCU-211 ## **Manual testing steps** ```gherkin Feature: RPC endpoint analytics tracking Scenario: user adds a network with first RPC endpoint Given the user is on the network settings screen When user adds a new network with an RPC URL Then RPC_ADDED event should be tracked with rpc_url_index: 0 and chain_id in hex format Scenario: user adds additional RPC endpoint to existing network Given the user has a network with at least one RPC endpoint configured When user adds an additional RPC endpoint to that network Then RPC_ADDED event should be tracked with rpc_url_index matching the new endpoint's index and chain_id in hex format Scenario: user removes an RPC endpoint from network Given the user has a network with multiple RPC endpoints configured When user deletes one of the RPC endpoints Then RPC_DELETED event should be tracked with rpc_url_index matching the deleted endpoint's index and chain_id in hex format Scenario: user adds network via wallet_addEthereumChain RPC method Given a dapp calls wallet_addEthereumChain with a new network When the network is successfully added Then RPC_ADDED event should be tracked with rpc_url_index: 0 and chain_id in hex format Scenario: user adds RPC endpoint to existing network via wallet_addEthereumChain Given a network already exists in the wallet When a dapp calls wallet_addEthereumChain with a different RPC URL for the same chainId Then RPC_ADDED event should be tracked with rpc_url_index matching the new endpoint's index and chain_id in hex format ``` ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [x] I’ve followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Mobile Coding Standards](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-mobile/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replaces NETWORK_ADDED with RPC_ADDED and adds RPC_REMOVED, standardizing chain_id to hex and capturing rpc_url_index across UI flows and wallet_addEthereumChain, with comprehensive tests. > > - **Analytics**: > - Rename `NETWORK_ADDED` to `RPC_ADDED`; add `RPC_REMOVED` in `core/Analytics/MetaMetrics.events.ts` and exports. > - Standardize `chain_id` to hex via `toHex`; add `rpc_url_index` to RPC events. > - **UI Tracking**: > - `components/UI/NetworkModal/index.tsx`: Track `RPC_ADDED` for popular/custom adds with `rpc_url_index: 0`. > - `Views/Settings/NetworksSettings/NetworkSettings/index.js`: > - On RPC add: track `RPC_ADDED` with `chain_id`, `symbol`, and computed `rpc_url_index`. > - On RPC delete: track `RPC_REMOVED` with `rpc_url_index`. > - **RPC Method**: > - `core/RPCMethods/wallet_addEthereumChain.js`: When updating/adding networks, emit `RPC_ADDED`: > - New network: `rpc_url_index: 0`. > - Existing network: only when a new RPC endpoint is appended; include correct index. > - **Tests**: > - Add/expand unit tests to assert `RPC_ADDED`/`RPC_REMOVED` emissions, index accuracy, and hex `chain_id` in `NetworkSettings` and `wallet_addEthereumChain`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit fd0489b. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )